package com.sooncode.project.focusservice.service;

import com.sooncode.project.core.finder.Finder;
import com.sooncode.project.core.finder.Page;
import com.sooncode.project.focusservice.model.CourseSubjects;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class CourseSubjectsService {
    public boolean add(Map map){
        CourseSubjects courseSubjects=new CourseSubjects();
        courseSubjects.add(map);
        return true;
    }
    public boolean modify(String id,Map map){
        CourseSubjects courseSubjects=getById(id);
        courseSubjects.modify(map);
        return true;
    }
    public boolean delete(String id){
        CourseSubjects courseSubjects=getById(id);
        courseSubjects.delete();
        return true;
    }
    public CourseSubjects getById(String id){
        return new Finder<>(CourseSubjects.class).byId(id);
    }
    public Page<CourseSubjects> getPageList(int pageSize, int pageIndex, Map map){
        return new Finder<>(CourseSubjects.class).byMap(map).page(pageSize,pageIndex);
    }

    public List<CourseSubjects> getList() {
        return new Finder<>(CourseSubjects.class).list();
    }
}
